package com.example.demo.controller;

import com.example.demo.entity.User;
import org.springframework.web.bind.annotation.*;

@RestController
public class HelloController {

    @RequestMapping(value = "/hello", method = RequestMethod.GET)
    public String hello(String name) {
        return "Hello" + name;
    }

    @RequestMapping(value = "/hello2", method = RequestMethod.GET)
    public String hello2(User user) {
        System.out.println(user);
        return "Hello2";
    }

    @RequestMapping(value = "/hello3", method = RequestMethod.GET)
    public String hello3(@RequestParam(value = "name") String name) {
        return "Hello3" + name;
    }

    @RequestMapping(value = "/hello4", method = RequestMethod.GET)
    public String hello4(@RequestBody User user) {//json文件
        System.out.println(user);

        return "Hello4";
    }


}
